package com.qjc.controller;
import com.qjc.mapper.StorageMapper;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
 * @Description: 仓储服务Controller
 */
@RestController
public class StorageController {

    @Resource
    StorageMapper storageMapper;

    /**
     * @Description: 库存减1
     * @Param: [commodityCode, count]
     * @Return: java.lang.String
     */
    @RequestMapping(value = "/storage/{commodityCode}/{count}", method = RequestMethod.GET, produces = "application/json")
    public String echo(@PathVariable String commodityCode,@PathVariable int count) {
        storageMapper.updateCountByCommodityCode(commodityCode,count);
        //操作多张表依然可以控制事务
//        storageMapper.updateCountByCommodityCode1(commodityCode);
        return "SUCCESS";
    }
}
